﻿#include "planitemfragment.h"
#include "ui_planitemfragment.h"

PlanItemFragment::PlanItemFragment(Plan plan,QWidget *parent) :
    QWidget(parent),
    ui(new Ui::PlanItemFragment) {
    ui->setupUi(this);
    this->plan = plan;
    ui->label_name->setText(plan.getName());
    if(plan.getType()==DAILY) {
        ui->label_type->setText(tr("Day plan"));
    } else {
        ui->label_type->setText(tr("Week plan"));
    }
    ui->textEdit_des->setText(plan.getEvents().values()[0].getName());
    Event event = plan.getEvents().values()[0];
    QVector<QString> people = event.getPeople();
    for(auto &x:people)ui->listWidget_peo->addItem(x);
}

PlanItemFragment::~PlanItemFragment() {
    delete ui;
}
